<script setup lang="ts">
import { reactive } from 'vue'
import { ElImage, ElInput } from 'element-plus'
import { Right } from '@element-plus/icons-vue'
import logo from '@/assets/logo.png'

const state = reactive({
  searchText: '',
  btnActive: -1
})
</script>

<template>
  <div class="header">
    <div>
      <el-image class="logo" :src="logo" fit="cover" style="width: 260px">
      </el-image>
    </div>
    <div>
      <el-input
        v-model="state.searchText"
        style="width: 500px"
        size="large"
        placeholder="请输入你的问题"
        :suffix-icon="Right"
      />
    </div>
    <div>
      <div class="mb-4">
        <ul>
          <li :class="state.btnActive == 0 ? 'active' : '' " @click="state.btnActive = 0">官方推荐</li>
          <li :class="state.btnActive == 1 ? 'active' : '' " @click="state.btnActive = 1">新增应用</li>
          <li :class="state.btnActive == 2 ? 'active' : '' " @click="state.btnActive = 2">最近使用</li>
          <li :class="state.btnActive == 3 ? 'active' : '' " @click="state.btnActive = 3">关联AI应用</li>
        </ul>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.header {
  display: flex;
  flex-direction: column;
  justify-items: center;
  align-items: center;
  gap: 10px;
  :deep(.el-input__wrapper) {
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 30px;
  }
  :deep(.el-input__suffix) {
    background-color: #555148;
    border-radius: 50%;
    padding: 10px;
    margin-right: -10px;
    width: 40px;
    height: 40px;
    .el-icon {
      font-size: 20px;
      margin-left: 0px;
    }
  }
  ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 10px;
    font-size: 14px;
    li {
      padding: 4px 8px;
      border-top-left-radius: 4px;
      border-top-right-radius: 4px;
      border-bottom-left-radius: 4px;
      border-bottom-right-radius: 4px;
      cursor: pointer;
      transition: all 0.05s ease;
      &:hover {
        color: #655548;
        background-color: #e9dac7;
      }
      &.active {
        color: #131b23;
        background-color: #e9dac7;
        transform: scale(0.98);
        opacity: 0.8;
      }
    }
  }
}
</style>
